package com.perfma.xtest.tool;

import java.io.File;

/**
 * @author: junhui.si
 * @date: 2023-07-24 17:19
 **/
public class A111 {

    public static void main(String[] args) {
        System.out.println(substringBeforeLast("shd/123/log", File.separator));
    }

    public static String substringBeforeLast(String str, String separator) {
        int pos = str.lastIndexOf(separator);
        return pos == -1 ? str : str.substring(0, pos);
    }
}
